package com.dianping.cat.consumer.matrix.model.entity;

import com.dianping.cat.consumer.matrix.model.BaseEntity;
import com.dianping.cat.consumer.matrix.model.IVisitor;
import java.util.LinkedHashMap;
import java.util.Map;








public class Matrix
  extends BaseEntity<Matrix>
{
  private String m_type;
  private String m_name;
  private int m_count;
  private long m_totalTime;
  private String m_url;
/*  23 */   private Map<String, Ratio> m_ratios = new LinkedHashMap();





  public Matrix(String name) { this.m_name = name; }




/*  34 */   public void accept(IVisitor visitor) { visitor.visitMatrix(this); }


  public Matrix addRatio(Ratio ratio) {
/*  38 */     this.m_ratios.put(ratio.getType(), ratio);
/*  39 */     return this;
  }


  public boolean equals(Object obj) {
/*  44 */     if (obj instanceof Matrix) {
/*  45 */       Matrix _o = (Matrix)obj;

/*  47 */       if (!equals(getName(), _o.getName())) {
/*  48 */         return false;
      }

/*  51 */       return true;
    }

/*  54 */     return false;
  }


/*  58 */   public Ratio findRatio(String type) { return (Ratio)this.m_ratios.get(type); }


  public Ratio findOrCreateRatio(String type) {
/*  62 */     Ratio ratio = (Ratio)this.m_ratios.get(type);

/*  64 */     if (ratio == null) {
/*  65 */       synchronized (this.m_ratios) {
/*  66 */         ratio = (Ratio)this.m_ratios.get(type);

/*  68 */         if (ratio == null) {
/*  69 */           ratio = new Ratio(type);
/*  70 */           this.m_ratios.put(type, ratio);
        }
      }
    }

/*  75 */     return ratio;
  }


/*  79 */   public int getCount() { return this.m_count; }



/*  83 */   public String getName() { return this.m_name; }



/*  87 */   public Map<String, Ratio> getRatios() { return this.m_ratios; }



/*  91 */   public long getTotalTime() { return this.m_totalTime; }



/*  95 */   public String getType() { return this.m_type; }



/*  99 */   public String getUrl() { return this.m_url; }



  public Matrix incCount() {
/* 112 */     this.m_count++;
/* 113 */     return this;
  }

  public Matrix incCount(int count) {
/* 117 */     this.m_count += count;
/* 118 */     return this;
  }


  public void mergeAttributes(Matrix other) {
/* 123 */     assertAttributeEquals(other, "matrix", "name", this.m_name, other.getName());

/* 125 */     if (other.getType() != null) {
/* 126 */       this.m_type = other.getType();
    }

/* 129 */     this.m_count = other.getCount();

/* 131 */     this.m_totalTime = other.getTotalTime();

/* 133 */     if (other.getUrl() != null) {
/* 134 */       this.m_url = other.getUrl();
    }
  }


/* 139 */   public Ratio removeRatio(String type) { return (Ratio)this.m_ratios.remove(type); }


  public Matrix setCount(int count) {
/* 143 */     this.m_count = count;
/* 144 */     return this;
  }

  public Matrix setName(String name) {
/* 148 */     this.m_name = name;
/* 149 */     return this;
  }

  public Matrix setTotalTime(long totalTime) {
/* 153 */     this.m_totalTime = totalTime;
/* 154 */     return this;
  }

  public Matrix setType(String type) {
/* 158 */     this.m_type = type;
/* 159 */     return this;
  }

  public Matrix setUrl(String url) {
/* 163 */     this.m_url = url;
/* 164 */     return this;
  }

  public Matrix() {}
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/lib/cat-consumer-3.0.0.jar!/com/dianping/cat/consumer/matrix/model/entity/Matrix.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */